<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	template="/WEB-INF/template/template2.xhtml">

	<ui:define name="content1">


		<p:growl id="messages" showDetail="true" />

		<h:form id="houseForm">

			<div class="container">

				<h:panelGrid rendered="#{!houseBean.confirmEdit}" class="table"
					columns="2" cellpadding="10">
					<h:outputText value="House password" />
					<p:password value="#{houseBean.housePass}" />
					<span />
					<p:commandButton value="Submit"
						action="#{houseBean.checkHousePassword}" ajax="false" />
				</h:panelGrid>

				<p:accordionPanel rendered="#{houseBean.confirmEdit}"
					multiple="true" style="width:auto !important">

					<p:tab title="General information">
						<h:panelGrid class="table" columns="2" cellpadding="10">
							<p:graphicImage
								value="/resources/images/#{houseBean.house.housePicture}"
								width="320" height="240" />
							<p:inputText value="#{houseBean.house.houseName}" />
							<span />
							<p:commandButton value="Save changes"
								actionListener="#{houseBean.saveHouseChanges}" ajax="true"
								update=":houseForm" />
						</h:panelGrid>
					</p:tab>

					<p:tab title="Address">
						<h:panelGrid class="table" columns="2" cellpadding="10">
							<h:outputLabel>Address</h:outputLabel>
							<p:inputText value="#{houseBean.house.address}" />

							<h:outputLabel>Postal code</h:outputLabel>
							<p:inputText value="#{houseBean.house.postalCode}" />

							<span />
							<p:commandButton value="Save changes"
								actionListener="#{houseBean.saveHouseChanges}" ajax="true"
								update=":houseForm" />
						</h:panelGrid>
					</p:tab>

					<p:tab title="Location">


						<h:panelGrid class="table" columns="1" cellpadding="10">
							<p:gmap id="gmap" type="HYBRID" zoom="15"
								center="#{houseBean.mapCenter}" style="width:380px;height:300px"
								model="#{houseBean.emptyModel}"
								onPointClick="handlePointClick(event)" widgetVar="map" />

							
						</h:panelGrid>
					</p:tab>
				</p:accordionPanel>



			</div>

		</h:form>
		<p:dialog widgetVar="dlg" effect="FADE" effectDuration="0.5"
			close="false" fixedCenter="true">
			<h:form prependId="false">
				<h:panelGrid columns="2">
					<h:outputLabel value="Changing house location, please confirm" />
					<span/>

					<f:facet name="footer">
						<p:commandButton value="Confirm"
							actionListener="#{houseBean.addMarker}" update=":messages"
							oncomplete="markerAddComplete()" />
						<p:commandButton value="Cancel" onclick="return cancel()" />
					</f:facet>
				</h:panelGrid>

				<h:inputHidden id="lat" value="#{houseBean.lat}" />
				<h:inputHidden id="lng" value="#{houseBean.lng}" />
			</h:form>
		</p:dialog>
	</ui:define>

</ui:composition>
